package com.vvv.designpattern.singleton;

/**
 * @author vvv
 * @date 2023-11-13 09 30
 * discription 不会发生线程安全问题， 因为静态内部类只会加载一次
 */
public class StaticInstance {
    private StaticInstance() {}
    private static class LazyHolder {
        static final StaticInstance staticInstance = new StaticInstance();
    }
    public static StaticInstance getInstance() {
        return LazyHolder.staticInstance;
    }
}
